Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Android build #6103

Open
wants to merge 43 commits into
base: master
Choose a base branch
from
Open

Update Android build #6103

wants to merge 43 commits into from

Conversation

kevlahnota
Copy link
Contributor

@kevlahnota kevlahnota commented Sep 8, 2024

  • Java 11
  • targetSDK 33
  • add modded uber-apk-signer.jar for signing cert

@tehdiplomat
Copy link
Contributor

tehdiplomat commented Sep 8, 2024

Awesome!

Some thoughts:

  • We should bump the versions up to 2.0.0 and announce that we're no longer going to be supporting Java 8 at the same time we merge this PR.
  • It might be nice to do one more full release that supports 1.8 before this gets merged.

@Hanmac
Copy link
Contributor

Hanmac commented Sep 8, 2024

@kevlahnota would be nice if we could implement #4977 in this update

@kevlahnota
Copy link
Contributor Author

@kevlahnota would be nice if we could implement #4977 in this update

Just push a new release / update the plugin https://github.com/Card-Forge/android-maven-plugin
it should work since the PR is merged.

@kevlahnota kevlahnota changed the title update android builds to SDK 29, use Java 11 update android builds to SDK 33, use Java 11 Sep 9, 2024
@kevlahnota kevlahnota closed this Sep 9, 2024
@kevlahnota kevlahnota reopened this Sep 9, 2024
@kevlahnota kevlahnota marked this pull request as draft September 9, 2024 07:53
@Hanmac Hanmac mentioned this pull request Sep 9, 2024
@Hanmac
Copy link
Contributor

Hanmac commented Sep 9, 2024

@kevlahnota kevlahnota changed the title update android builds to SDK 33, use Java 11 update android builds to SDK 29, use Java 11 Sep 9, 2024
@kevlahnota
Copy link
Contributor Author

@kevlahnota for Signing, checkout ~~ https://github.com/MuntashirAkon/apksig-android ~~

Better: https://github.com/jenkinsci/android-signing-plugin

Reverted to sdk 29, seems target sdk 33 and above somehow don't allow installation without proper signature/signing on latest android version (tested with android 14)

@kevlahnota kevlahnota marked this pull request as ready for review September 10, 2024 10:01
@kevlahnota
Copy link
Contributor Author

Reverted to sdk 29, seems target sdk 33 and above somehow don't allow installation without proper signature/signing on latest android version (tested with android 14)

Isn't it just that it needs to be signed with signature scheme v2? https://developer.android.com/about/versions/11/behavior-changes-11#minimum-signature-scheme Should be possible but it would need an upgrade from jarsigner. Which I guess would also mean an upgrade from simpligility, since that hasn't been updated since 2019? I'm not too experienced with Maven workflows.

I think the requirement that the app target the latest Android version is only if you're releasing an app on the Google Play store.

From android sdk 30 and above, the resources.arsc needs to be uncompressed inside the apk, the rest have no problem being compressed. Then you need to zipalign and sign with v2 and it will install fine. I have a working build on my local computer but It's a hassle to manually fix those things. Yes it's requirement for playstore but using latest sdk stops the nagging popup that the apk is outdated and latest sdk supports more java api (sdk 34 uses java 17)

@kevlahnota kevlahnota changed the title update android builds to SDK 29, use Java 11 Update Android build Sep 14, 2024
@@ -89,7 +89,7 @@ jobs:
d=$(date +%m-%d)
# Replace date in forge-gui-mobile/src/forge/Forge.java
sed -i -e "s/-SNAPSHOT/-SNAPSHOT-${d}/g" forge-gui-mobile/src/forge/Forge.java
mvn -U -B -P android-release-build,android-release-sign install -e -Dsign.keystore=forge.keystore -Dsign.alias=Forge -Dsign.storepass=${{ secrets.SIGN_STORE_PASS }} -Dsign.keypass=${{ secrets.SIGN_STORE_PASS }} -Dcardforge-repo.username=${{ secrets.FTP_USERNAME }} -Dcardforge-repo.password=${{ secrets.FTP_PASSWORD }} -Dandroid.sdk.path=/usr/local/lib/android/sdk -Dandroid.buildToolsVersion=30.0.3 -Dmaven.test.skip=true
mvn -U -B -P android-release-build install -e -Dcardforge-repo.username=${{ secrets.FTP_USERNAME }} -Dcardforge-repo.password=${{ secrets.FTP_PASSWORD }} -Dandroid.sdk.path=/usr/local/lib/android/sdk -Dandroid.buildToolsVersion=33.0.2 -Dmaven.test.skip=true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Signing isn't needed anymore?

Copy link
Contributor Author

@kevlahnota kevlahnota Sep 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's included on the android pom file, it will sign with v2, v3 on install phase using the modded signer

<plugin>
	<artifactId>exec-maven-plugin</artifactId>
	<version>3.4.1</version>
	<groupId>org.codehaus.mojo</groupId>
	<executions>
		<execution>
			<id>SignV2</id>
			<phase>install</phase>
			<goals>
				<goal>exec</goal>
			</goals>
		</execution>
	</executions>
	<configuration>
		<workingDirectory>${pom.basedir}</workingDirectory>
		<executable>java</executable>
		<arguments>
			<argument>-jar</argument>
			<argument>${pom.basedir}/tools/uber-apk-signer.jar</argument>
			<argument>-a</argument>
			<argument>${pom.basedir}/target/</argument>
			<argument>--ks</argument>
			<argument>forge.keystore</argument>
			<argument>--ksAlias</argument>
			<argument>Forge</argument>
			<argument>--ksKeyPass</argument>
			<argument>forge72</argument>
			<argument>--ksPass</argument>
			<argument>forge72</argument>
			<argument>--debug</argument>
		</arguments>
	</configuration>
</plugin>

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are those keystore passwords just placeholders for testing?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check publish.bat in android module.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Knowing that the keystore credentials have already been in a publicly visible file for the last 9 years isn't doing much to mitigate my concern... Someone would still need the keystore itself to do anything malicious but if those are the actual passwords then that's a layer of security that isn't doing anything.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the github actions template works on the pom file, feel free to update it since I don't know how those variable interact from github to maven via pom file

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll admit I don't know much about that either, and the credentials would need to be changed by someone with more access than me anyway. I could open an issue for it but I'm hesitant to give security problems more visibility than necessary. It's probably not a huge problem in the short term though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants